'use strict';

const Service = require('egg').Service;

class EditNoteService extends Service {
    async echo(query) {
        const user = await this.ctx.model.Notes.findOne({
            where: {
                ID: query
            }
        })

        return user
    }

    async upNote(data) {
        const user = await this.ctx.model.Notes.update({
            title: data.title,
            content: data.content,
            dateTime: data.time,
            upload: data.url,
            userID: data.userID
        }, {
                where: {
                    ID: data.id
                }
            }
        )

        return user
    }
}

module.exports = EditNoteService;
